﻿using AutoMapper;
using AutoMapper.EquivalencyExpression;
using Volo.Abp.AuditLogging;
using Volo.Abp.Domain.Values;
using Volo.Abp.Identity;

namespace Acme.BookStore2
{
    public class BookStore2ApplicationAutoMapperProfile : Profile
    {
        public BookStore2ApplicationAutoMapperProfile()
        {
            /* You can configure your AutoMapper mapping configuration here.
             * Alternatively, you can split your mapping configurations
             * into multiple profile classes for a better organization. */

            //OrganizationUnit
            CreateMap<OrganizationUnit, OrganizationUnitDto>().MapExtraProperties();
            CreateMap<OrganizationUnitRole, OrganizationUnitRoleDto>();
            
            //IdentitySecurityLog
            CreateMap<IdentitySecurityLog, SecurityLogDto>().MapExtraProperties();

            
            //AuditLog
            CreateMap<AuditLog, AuditLogDto>().MapExtraProperties();
            CreateMap<EntityChange, EntityChangeDto>().MapExtraProperties();
            CreateMap<EntityPropertyChange, EntityPropertyChangeDto>();
            CreateMap<AuditLogAction, AuditLogActionDto>();
            
            //Vehicle
            CreateMap<Vehicle, VehicleDto>().MapExtraProperties();
            CreateMap<VehicleInspectionRecord, VehicleInspectionRecordDto>().MapExtraProperties();
            CreateMap<VehicleRepairRecord, VehicleRepairRecordDto>().MapExtraProperties();
            CreateMap<VehicleMaintenanceRecord, VehicleMaintenanceRecordDto>().MapExtraProperties();
            CreateMap<VehicleDriveRecord, VehicleDriveRecordDto>().MapExtraProperties();
            
            //Attach File
            CreateMap<AttachFile, AttachFileDto>();
            CreateMap<AttachFileDto, AttachFile>().EqualityComparison((s, d) => s.Id == d.Id);
            
            //WorkSchedule
            CreateMap<WorkSchedule, WorkScheduleDto>();
            CreateMap<WorkScheduleItem, WorkScheduleItemDto>();
            
            //QuestionAndAnswerPost
            CreateMap<QuestionAndAnswerPost, QuestionAndAnswerPostDto>();
        }
    }
}
